package com.byd.dms.enums;

//import com.alibaba.fastjson.JSONValidator;

import com.alibaba.fastjson.JSONValidator;
import com.alibaba.fastjson.serializer.JSONSerializer;
import com.alibaba.fastjson.serializer.ObjectSerializer;
import com.alibaba.fastjson.serializer.SerializeWriter;

import java.io.IOException;
import java.lang.reflect.Type;

public class StatusSerializer implements ObjectSerializer {
    
    public void write(JSONSerializer serializer, Object object,
                      Object fieldName, Type fieldType, int i) throws IOException {
        SerializeWriter out = serializer.getWriter();
        
        System.out.println("object = " + object + ", " + object.getClass().getName());
        System.out.println("fieldName = " + fieldName);
        System.out.println("fieldType = " + fieldType);
        if (object == null) {
            serializer.getWriter().writeNull();
            return;
        }
        //out.write("hello");
        int value = Status.value((Status) object);
        //System.out.println("value = " + value);
        out.write(value + "");
    }
    
    
}